﻿
extern alias System;

using System.IO;    

namespace StyleCop.For.ReSharper.TestProject.Ordering
{
    using System;
    using System.Runtime.InteropServices;

    public class TestClass1 : ITestInterface1, ITestInterface2
    {
        private void Method1()
        {
            var f = File.CreateText("c:\temp.txt");
        }
        
        protected void Method2()
        {
            var f = File.CreateText("c:\temp.txt");
        }

        protected internal void Method3()
        {
            var f = File.CreateText("c:\temp.txt");
        }

        internal void Method4()
        {
            var f = File.CreateText("c:\temp.txt");
        }

        public void Method5()
        {
            var f = File.CreateText("c:\temp.txt");
        }

        public static void Method6()
        {
            var f = File.CreateText("c:\temp.txt");
        }
        
        public static bool operator ==(TestClass1 x, TestClass1 y)
        {
            return true;
        }

        public static bool operator !=(TestClass1 x, TestClass1 y)
        {
            return false;
        }

        private string this[string index]
        {
            get
            {
                return string.Empty;
            }

            set
            {
                var v = value;
            }
        }

        protected string this[int index]
        {
            get
            {
                return string.Empty;
            }

            set
            {
                var v = value;
            }
        }

        protected internal string this[long index]
        {
            get
            {
                return string.Empty;
            }

            set
            {
                var v = value;
            }
        }

        internal string this[bool index]
        {
            get
            {
                return string.Empty;
            }

            set
            {
                var v = value;
            }
        }

        public string this[double index]
        {
            get
            {
                return string.Empty;
            }

            set
            {
                var v = value;
            }
        }

        private string Property1 { get; set; }
        private static string Property2 { get; set; }
        protected string Property3 { get; set; }
        protected static string Property4 { get; set; }
        protected internal string Property5 { get; set; }
        protected internal static string Property6 { get; set; }
        internal string Property7 { get; set; }
        internal static string Property8 { get; set; }
        public string Property9 { get; set; }
        public static string Property10 { get; set; }

        void ITestInterface2.Method101()
        {
        }

        public void Method103()
        {
            this.Event1 += this.TestClass1_Event1;
            this.Event1 += this.TestClass1_Event3;
            this.Event1 += this.TestClass1_Event5;
            this.Event1 += this.TestClass1_Event7;
            this.Event1 += this.TestClass1_Event9;
        }

        public static void Method104()
        {
            Event6 += TestClass1_Event2;
            Event6 += TestClass1_Event6;
            Event6 += TestClass1_Event4;
            Event6 += TestClass1_Event8;
            Event6 += TestClass1_Event10;
        }

        private void TestClass1_Event1(object sender, EventArgs e)
        {
            throw new NotImplementedException();
        }

        private static void TestClass1_Event2(object sender, EventArgs e)
        {
            throw new NotImplementedException();
        }

        protected void TestClass1_Event3(object sender, EventArgs e)
        {
            throw new NotImplementedException();
        }

        protected static void TestClass1_Event4(object sender, EventArgs e)
        {
            throw new NotImplementedException();
        }

        protected internal void TestClass1_Event5(object sender, EventArgs e)
        {
            throw new NotImplementedException();
        }

        protected internal static void TestClass1_Event6(object sender, EventArgs e)
        {
            throw new NotImplementedException();
        }

        internal  void TestClass1_Event7(object sender, EventArgs e)
        {
            throw new NotImplementedException();
        }

        internal static void TestClass1_Event8(object sender, EventArgs e)
        {
            throw new NotImplementedException();
        }

        public void TestClass1_Event9(object sender, EventArgs e)
        {
            throw new NotImplementedException();
        }

        public static void TestClass1_Event10(object sender, EventArgs e)
        {
            throw new NotImplementedException();
        }

        void ITestInterface1.Method102()
        {
        }

        public interface IBob
        {
        }

        private enum TestEnum1
        {
            EnumItem1,
            EnumItem2
        }

        protected enum TestEnum2
        {
            EnumItem1,
            EnumItem2
        }

        protected internal enum TestEnum3
        {
            EnumItem1,
            EnumItem2
        }

        internal enum TestEnum4
        {
            EnumItem1,
            EnumItem2
        }

        public enum TestEnum5
        {
            EnumItem1,
            EnumItem2
        }
        
        private event EventHandler Event1
        {
            remove
            {
                var v = value;
            }
            
            add
            {
                var v = value;
            }
        }

        protected event EventHandler Event2
        {
            remove
            {
                var v = value;
            }

            add
            {
                var v = value;
            }
        }

        protected internal event EventHandler Event3
        {
            remove
            {
                var v = value;
            }

            add
            {
                var v = value;
            }
        }

        internal event EventHandler Event4
        {
            remove
            {
                var v = value;
            }

            add
            {
                var v = value;
            }
        }

        public event EventHandler Event5
        {
            remove
            {
                var v = value;
            }

            add
            {
                var v = value;
            }
        }

        private static event EventHandler Event6
        {
            remove
            {
                var v = value;
            }

            add
            {
                var v = value;
            }
        }

        private event EventHandler Event7;
        protected event EventHandler Event8;
        protected internal event EventHandler Event9;
        internal event EventHandler Event10;
        public event EventHandler Event11;

        private delegate void SimpleDelegate1();
        protected delegate void SimpleDelegate2();
        protected internal delegate void SimpleDelegate3();
        internal delegate void SimpleDelegate4();
        public delegate void SimpleDelegate5();
        
        public ~TestClass1()
        {
        }
        
        private TestClass1(int i, int j)
        {
        }

        static TestClass1()
        {
        }

        protected TestClass1(int i, int j, int k)
        {
        }

        protected internal TestClass1(string i)
        {
        }

        internal TestClass1(bool i)
        {
        }

        public TestClass1(int i)
        {
        }
        
        public TestClass1()
            : this(6)
        {
        }
        
        private string field1;
        private static string field2;
        protected string field3;
        protected static string field4;
        protected internal string field5;
        protected internal static string field6;
        internal string field7;
        internal static string field8;
        public string field9;
        public static string field10;

        private readonly string field11;
        private static readonly string field12;
        protected readonly string field13 = "f";
        protected static readonly string field14 = "f";
        protected internal readonly string field15 = "f";
        protected internal static readonly string field16 = "f";
        internal readonly string field17 = "f";
        internal static readonly string field18 = "f";
        public readonly string field19 = "f";
        public static readonly string field20 = "f";
        
        private const string const1 = "a";
        protected const string const2 = "a";
        protected internal const string const3 = "a";
        internal const string const4 = "a";
        public const string const5 = "a";
    }


    public class TestClass2NativeMethods : ITestInterface1, ITestInterface2
    {
        private void Method1()
        {
            var f = File.CreateText("c:\temp.txt");
        }

        protected void Method2()
        {
            var f = File.CreateText("c:\temp.txt");
        }

        protected internal void Method3()
        {
            var f = File.CreateText("c:\temp.txt");
        }

        internal void Method4()
        {
            var f = File.CreateText("c:\temp.txt");
        }

        public void Method5()
        {
            var f = File.CreateText("c:\temp.txt");
        }

        public static void Method6()
        {
            var f = File.CreateText("c:\temp.txt");
        }

        public static bool operator ==(TestClass2NativeMethods x, TestClass2NativeMethods y)
        {
            return true;
        }

        public static bool operator !=(TestClass2NativeMethods x, TestClass2NativeMethods y)
        {
            return false;
        }

        private string this[string index]
        {
            get
            {
                return string.Empty;
            }

            set
            {
                var v = value;
            }
        }

        protected string this[int index]
        {
            get
            {
                return string.Empty;
            }

            set
            {
                var v = value;
            }
        }

        protected internal string this[long index]
        {
            get
            {
                return string.Empty;
            }

            set
            {
                var v = value;
            }
        }

        internal string this[bool index]
        {
            get
            {
                return string.Empty;
            }

            set
            {
                var v = value;
            }
        }

        public string this[double index]
        {
            get
            {
                return string.Empty;
            }

            set
            {
                var v = value;
            }
        }

        private string Property1 { get; set; }
        private static string Property2 { get; set; }
        protected string Property3 { get; set; }
        protected static string Property4 { get; set; }
        protected internal string Property5 { get; set; }
        protected internal static string Property6 { get; set; }
        internal string Property7 { get; set; }
        internal static string Property8 { get; set; }
        public string Property9 { get; set; }
        public static string Property10 { get; set; }

        void ITestInterface2.Method101()
        {
        }

        public void Method103()
        {
        }

        void ITestInterface1.Method102()
        {
        }

        public interface IBob
        {
        }

        private enum TestEnum1
        {
            EnumItem1,
            EnumItem2
        }

        protected enum TestEnum2
        {
            EnumItem1,
            EnumItem2
        }

        protected internal enum TestEnum3
        {
            EnumItem1,
            EnumItem2
        }

        internal enum TestEnum4
        {
            EnumItem1,
            EnumItem2
        }

        public enum TestEnum5
        {
            EnumItem1,
            EnumItem2
        }

        private event EventHandler Event1
        {
            remove
            {
                var v = value;
            }

            add
            {
                var v = value;
            }
        }

        protected event EventHandler Event2
        {
            remove
            {
                var v = value;
            }

            add
            {
                var v = value;
            }
        }

        protected internal event EventHandler Event3
        {
            remove
            {
                var v = value;
            }

            add
            {
                var v = value;
            }
        }

        internal event EventHandler Event4
        {
            remove
            {
                var v = value;
            }

            add
            {
                var v = value;
            }
        }

        public event EventHandler Event5
        {
            remove
            {
                var v = value;
            }

            add
            {
                var v = value;
            }
        }

        private event EventHandler EventHandler1;
        protected event EventHandler EventHandler2;
        protected internal event EventHandler EventHandler3;
        internal event EventHandler EventHandler4;
        public event EventHandler EventHandler5;

        private delegate void SimpleDelegate1();
        protected delegate void SimpleDelegate2();
        protected internal delegate void SimpleDelegate3();
        internal delegate void SimpleDelegate4();
        public delegate void SimpleDelegate5();

        public ~TestClass2NativeMethods()
        {
        }

        private TestClass2NativeMethods(int i, int j)
        {
        }

        static TestClass2NativeMethods()
        {
        }

        protected TestClass2NativeMethods(int i, int j, int k)
        {
        }

        protected internal TestClass2NativeMethods(string i)
        {
        }

        internal TestClass2NativeMethods(bool i)
        {
        }

        public TestClass2NativeMethods(int i)
        {
        }

        public TestClass2NativeMethods()
            : this(6)
        {
        }

        private string field1;
        private static string field2;
        protected string field3;
        protected static string field4;
        protected internal string field5;
        protected internal static string field6;
        internal string field7;
        internal static string field8;
        public string field9;
        public static string field10;

        private readonly string field11;
        private static readonly string field12;
        protected readonly string field13 = "f";
        protected static readonly string field14 = "f";
        protected internal readonly string field15 = "f";
        protected internal static readonly string field16 = "f";
        internal readonly string field17 = "f";
        internal static readonly string field18 = "f";
        public readonly string field19 = "f";
        public static readonly string field20 = "f";

        private const string const1 = "a";
        protected const string const2 = "a";
        protected internal const string const3 = "a";
        internal const string const4 = "a";
        public const string const5 = "a";
    }
    
    public struct Struct1
    {
        private string prop1;
    }

    public interface ITestInterface2
    {
        void Method103();
        void Method101();
    }

    public interface ITestInterface1
    {
        void Method102();
    }

    public enum TestEnum1
    {
        EnumItem1,
        EnumItem2,
        AItem3
    }

    [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
    public interface IBob
    {
        bool MethodB();

        bool MethodA();
    }
}